﻿using Microsoft.VisualBasic.ApplicationServices;
using System;
using System.Collections.Generic;
using System.Text;

namespace _19.单实例应用程序 {
    class SingleInstanceApplicationWrapper: WindowsFormsApplicationBase {
        public SingleInstanceApplicationWrapper() {
            this.IsSingleInstance= true;
        }

        private WpfApp app;
        protected override bool OnStartup(StartupEventArgs eventArgs) {

            //return base.OnStartup(eventArgs);
            app = new WpfApp();
            app.Run();
            return false;
        }

        protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs) {
            base.OnStartupNextInstance(eventArgs);
            app.showWindow();
        }
    }
}
